<?php
/**
 * Classe para envio de e-mail
 * Author: Bruno Ramos <contato [AT] brunoramos [DOT] eti [DOT] br>
 * File: email.class.php
 * Version: 1.0
 */
 
class Email {
	public $to;
	public $from;
	public $reply;
	public $subject;
	public $body;
	public function __construct($to, $from, $reply, $subject, $body) {
		$this->to = $to;
		$this->from = $from;
		$this->reply = $reply;
		$this->subject = $subject;
		$this->body = $body;
	}
	public function send() {
		$headers = "From: ".$this->from."\r\n";
		$headers .= "Reply-To: ".$this->reply."\r\n";
		$headers .= "MIME-Version: 1.0\r\n";
		$headers .= "Content-Type: text/html; charset=utf-8\r\n";	
		$date = date("d/m/Y h:i");
		$ip = getenv("REMOTE_ADDR");
		
		$mensagem = '
			<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
			<html xmlns="http://www.w3.org/1999/xhtml">
			<head>
			<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
			</head>
			
			<body>
			<div>
				'.$this->body.'
			</div>
			<div style="font-size:10px;margin-top:15px;">Enviado em: '.$date.'<br />IP: '.getenv("REMOTE_ADDR").'</div>
			</body>
			</html>
		';	
		return mail($this->to, $this->subject, $mensagem, $headers);	
	}
}
?>